﻿#region Using directives

using System;
using System.Collections.Generic;
using System.Text;

#endregion

namespace Weazel.Toad.Application.Actions
{
	public class ExitApplicationAction : ActionBase
	{
		public ExitApplicationAction()
		{
		}

		public override void Execute(object sender, EventArgs e)
		{
			// todo: ask user if data should be saved ;)

            if (Application.Instance.CloseAllItems())
            {
                System.Environment.Exit(0);
            }
            else
            {
                System.Windows.Forms.FormClosingEventArgs args =
                   e as System.Windows.Forms.FormClosingEventArgs;

                if (args != null)
                    args.Cancel = true;
            }
		} 
	}
}
